import axios from '@/libs/api.request'
import { getToken } from '@/libs/util'

class DeviceFavorite {
  constructor() {
    this.$axios = axios;
  }

  findByUser=(param)=>{
    return axios.request({
      url: "admin/device/favorite/find/by/user",
      method: 'post',
      dataType: 'json',
      headers: {
        'Content-Type': 'application/json; charset=UTF-8',
        'token': getToken()
      },
      data: param
    })
  }

  add=(param)=>{
    console.log(param)
    return axios.request({
      url: '/admin/device/favorite/new',
      method: 'post',
      dataType: 'json',
      headers: {
        'Content-Type': 'application/json; charset=UTF-8',
        'token': getToken()
      },
      data: param
    })
  }

  remove=(param)=>{
    return axios.request({
      url: '/admin/device/favorite/cancel',
      method: 'post',
      dataType: 'json',
      headers: {
        'Content-Type': 'application/json; charset=UTF-8',
        'token': getToken()
      },
      data: param
    })
  }
}
export default DeviceFavorite;
